package main

import (
	"fmt"
	sq "github.com/elgris/sqrl"
)
func main() {
	users := sq.Select("*").From("users").Join("emails USING (email_id)")
	active := users.Where(sq.Eq{"deleted_at": nil}).
		Where("sex=?",1).
		Where(sq.Eq{"status":1}).
		Where(sq.Eq{"username": []string{"moe", "larry", "curly", "shemp"}}).Offset(0).Limit(10)
	query, args, err := active.ToSql()
	// query == "SELECT * FROM users JOIN emails USING (email_id) WHERE deleted_at IS NULL AND sex=? AND status=? AND username in (?,?,?,?) offset 0 limit 10"
	// args == [1,1,"moe", "larry", "curly", "shemp",0,10]
	fmt.Println(query,args,err)
}
